﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" name="viewport" content="width=device-width" />
    <title>生产管理粗纱机</title>
    <link href="../css/bootstrap.min.css" rel="stylesheet" />
    <script src="../Content/scripts/jquery-1.11.1.min.js"></script>
    <link href="../Content/styles/font-awesome.min.css" rel="stylesheet" />
    <link href="../Content/scripts/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/jquery-ui/jquery-ui.min.js"></script>
    <link href="../Content/scripts/bootstrap/bootstrap.min.css" rel="stylesheet" />
    <script src="../Content/scripts/bootstrap/bootstrap.min.js"></script>
    <link href="../Content/scripts/plugins/jqgrid/jqgrid.css" rel="stylesheet" />
    <link href="../Content/adminLTE/css/index.css" rel="stylesheet" />
    <link href="../Content/styles/learun-ui.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/jqgrid/grid.locale-cn.js"></script>
    <script src="../Content/scripts/plugins/jqgrid/jqgrid.min.js"></script>
    <script src="../Content/scripts/plugins/tree/tree.js"></script>
    <script src="../Content/scripts/plugins/validator/validator.js"></script>
    <script src="../Content/scripts/plugins/dialog/dialog.js"></script>
    <script src="../Content/scripts/utils/learun-ui.js"></script>
    <script src="../Content/scripts/utils/learun-form.js"></script>

    <script src="../Content/scripts/plugins/layout/jquery.layout.js"></script>
    <script src="../My97DatePicker/WdatePicker.js"></script>
    <script src="../js/highcharts.js"></script>
    <script src="../js/highcharts-3d.js"></script>
    <script src="../js/getUrlParam.js"></script>
    <script src="MFGjs.js"></script>


    <style type="text/css">
        body {
            margin: 0px;
            margin-top: 10px;
        }

        .form .formTitle {
            width: 150px;
            font-size: 25px;
        }

        .valuestyle {
            font-size: 25px;
        }

        #title {
            font-size: 30px;
            text-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
        }

        #time {
            font-size: 20px;
            float: right;
            line-height: 50px;
            right: 40px;
            position: fixed;
            color: #65b540;
        }

        @media screen and (min-width:1281px) and (max-width:1440px) {
            .valuestyle {
                font-size: 20px;
            }

            .form .formTitle {
                font-size: 20px;
            }
        }

        #info {
            float: right;
            color: #ff0000;
            font-size: 9px;
        }

        a {
            color: skyblue;
            text-decoration: none;
        }

        span {
            border-radius: 100px;
        }
    </style>
</head>

<body>
    <div style="text-align: center; height: 50px;">
        <span id="title">生产信息</span>
        <span id="time"></span>
    </div>
    <ul id="myTab" class="nav nav-tabs">
        <li class="active">
            <a href="#home" data-toggle="tab">
                基本信息
            </a>
        </li>
        <li>
            <a href="#cusha" data-toggle="tab">粗纱机信息</a>
        </li>
        <li>
            <a href="#weisha" data-toggle="tab">尾纱机信息</a>
        </li>
        <li class="dropdown">
            <a href="#" id="myTabDrop1" class="dropdown-toggle"
               data-toggle="dropdown">
                轨道 <b class="caret"></b>
            </a>
            <ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
                <li>
                    <a href="#guidaoshengchan" tabindex="-1" data-toggle="tab">
                        生产管理
                    </a>
                </li>
                <li>
                    <a href="#guidaoshebei" tabindex="-1" data-toggle="tab">
                        设备管理
                    </a>
                </li>
                <li>
                    <a href="#guililishijilu" tabindex="-1" data-toggle="tab">
                        历史记录列表
                    </a>
                </li>
            </ul>
        </li>
    </ul>
    <div id="myTabContent" class="tab-content">
        <div class="tab-pane fade in active" id="home">
            <div class="ui-layout" id="layout" style="width:100%;">
                <div class="ui-layout-west" id="westpanel">
                    <div class="west-Panel">
                        <div class="panel-Title">车间布局图</div>
                        <img src="" id="chejianimg" />
                    </div>
                </div>

                <div class="ui-layout-center" id="centerpanel">
                    <div class="center-Panel">
                        <div class="panel-Title">目标产量完成产量</div>
                        <table class="form" id="ruleinfo">
                            <tr>
                                <th class="formTitle">目标产量:</th>
                                <td class="formValue">
                                    <label class="valuestyle" id="mubiaochanliang">40S</label>
                                </td>
                                <td class="formValue">
                                    <label class="valuestyle">1T</label>
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle">粗纱:</th>
                                <td class="formValue">
                                    <label class="valuestyle">60S</label>
                                </td>
                                <td class="formValue">
                                    <label class="valuestyle">1.5T</label>
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle"></th>
                                <td class="formValue">
                                    <label class="valuestyle">100S</label>
                                </td>
                                <td class="formValue">
                                    <label class="valuestyle">1T</label>
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle">完成产量:</th>
                                <td class="formValue">
                                    <label class="valuestyle">40S</label>
                                </td>
                                <td class="formValue">
                                    <label class="valuestyle">0.8T</label>
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle">粗纱:</th>
                                <td class="formValue">
                                    <label class="valuestyle">60S</label>
                                </td>
                                <td class="formValue">
                                    <label class="valuestyle">1.5T</label>
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle"></th>
                                <td class="formValue">
                                    <label class="valuestyle">100S</label>
                                </td>
                                <td class="formValue">
                                    <label class="valuestyle">1T</label>
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle">尾纱管:</th>
                                <td class="formValue">
                                    <label class="valuestyle">1000个</label>
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle">纱库:</th>
                                <td class="formValue">
                                    <label class="valuestyle">40S</label>
                                </td>
                                <td class="formValue">
                                    <label class="valuestyle">420锭</label>
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle"></th>
                                <td class="formValue">
                                    <label class="valuestyle">60S</label>
                                </td>
                                <td class="formValue">
                                    <label class="valuestyle">300锭</label>
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle"></th>
                                <td class="formValue">
                                    <label class="valuestyle">100S</label>
                                </td>
                                <td class="formValue">
                                    <label class="valuestyle">400锭</label>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>


        <div class="tab-pane fade" id="cusha">
            <div class="ui-layout" id="layoutcusha" style="width:100%;">
                <div class="ui-layout-west" id="cushawestpanel">
                    <div class="west-Panel">
                        <div class="panel-Title">粗纱信息列表 <span id="info">注：左侧选中粗纱台号,查看相关信息</span></div>
                        <div class="titlePanel">

                            <div class="toolbar">
                                <div class="btn-group">
                                    <a id="lr-add" class="btn btn-default" onclick="btn_shengchan(event)">
                                        <i class="fa fa-plus"></i>&nbsp;生产信息
                                    </a>
                                    <a id="lr-edit" class="btn btn-default" onclick="btn_shebei(event)">
                                        <i class="fa fa-pencil-square-o"></i>&nbsp;设备管理
                                    </a>

                                    <a id="lr-delete" class="btn btn-default" onclick="btn_state(event)">
                                        <i class="fa fa-trash-o"></i>&nbsp;主机状态列表
                                    </a>
                                </div>
                            </div>
                        </div>
                        <table id="gridTable"></table>
                        <div id="west-Panel">

                        </div>
                    </div>
                </div>

                <div class="ui-layout-center" id="cushacenterpanel">

                </div>
            </div>

        </div>
        <div class="tab-pane fade" id="weisha">

        </div>
        <div class="tab-pane fade" id="guidaoshengchan">
            <div class="ui-layout" id="layoutguidaoshengchan" style="width:100%;">
                <div class="ui-layout-west" id="guidaoshengchanwestpanel">
                    <div class="west-Panel">
                        <div class="panel-Title">今日信息列表 </div>

                        <table id="guidaoshengchangridTable"></table>

                    </div>
                </div>

                <div class="ui-layout-center" id="guidaoshengchancenterpanel">

                </div>
            </div>
        </div>
    </div>
    <script>
        var IDs = UrlParam.paramValues("ID");
        var ID = IDs[0];
        var width = "";
        var height = "";

        $(document).ready(function () {
            width = $(window).width();
            height = $(window).height();
            $("#layout").height(height - 120);
            $("#layoutcusha").height(height - 120);
            $("#westpanel").height(height - 120);
            $("#centerpanel").height(height - 100);
            $("#chejianimg").height(height - 180);
            $("#ruleinfo").height(height - 180);
            $("#chejianimg").width(width - 450);

            //$('#gridTable').setGridWidth(($('.gridPanel').width()));
            $("#gridTable").setGridHeight($("#cushawestpanel").height() * 0.5);

            $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {

                // 获取已激活的标签页的名称
                var activeTab = $(e.target).attr('href');

                if (activeTab == '#cusha') {
                    //layout布局
                    $('#layoutcusha').layout({
                        applyDemoStyles: true,
                        west: {
                            size: $(window).width() * 0.4
                        },
                        onresize: function () {
                            $(window).resize()
                        }
                    });

                    $("#west-Panel").html("");
                    $("#cushacenterpanel").html("");

                    // 获取粗纱机列表信息
                    $.mfgjs.getEquNoListByID(ID);
                    $("#gridTable").jqGrid('resetSelection');

                }
                else if (activeTab == '#guidaoshengchan') {
                    $("#layoutguidaoshengchan").height(height - 120);
                    //layout布局
                    $('#layoutguidaoshengchan').layout({
                        applyDemoStyles: true,
                        west: {
                            size: $(window).width() * 0.45
                        },
                        onresize: function () {
                            $(window).resize()
                        }
                    });
                    //$("#west-Panel").html("");
                    //$("#cushacenterpanel").html("");

                    // 获取粗纱机列表信息
                    $.mfgjs.getguidaoshengchanByID(ID);
                    $.mfgjs.initguidaoshengchanjiemian();
                    $.mfgjs.mansharukubingtu();
                    $("#guidaoshengchangridTable").jqGrid('resetSelection');
                }
            });
        })


        //layout布局
        $('#layout').layout({
            applyDemoStyles: true,
            west: {
                size: $(window).width() - 400
            },
            onresize: function () {
                $(window).resize()
            }
        });

        $.mfgjs.getCustomInfoByID(ID);

        setInterval(function () {
            fnDate();
        }, 1000);

        //js 获取当前时间
        function fnDate() {
            var oDiv = document.getElementById("time");
            var date = new Date();
            var year = date.getFullYear();//当前年份
            var month = date.getMonth();//当前月份
            var data = date.getDate();//天
            var hours = date.getHours();//小时
            var minute = date.getMinutes();//分
            var second = date.getSeconds();//秒
            var time = year + "-" + fnW((month + 1)) + "-" + fnW(data) + " " + fnW(hours) + ":" + fnW(minute) + ":" + fnW(second);
            oDiv.innerHTML = time;
        }
        //补位 当某个字段不是两位数时补0
        function fnW(str) {
            var num;
            str > 9 ? num = str : num = "0" + str;
            return num;
        }


        function btn_shengchan(event) {

            var keyValue = $("#gridTable").jqGridRowValue("EquNo");

            if (checkedRow(keyValue)) {
                $("#cushacenterpanel").html("");

                //初始化生产界面图
                $.mfgjs.initshengchancushajiemian();
                $("#cushawestpanel").height(height - 100);
                $("#cushacenterpanel").height(height - 120);
                $("#gridTable").setGridHeight($("#cushawestpanel").height() * 0.5);
                $("#cushashengchan").height($("#cushacenterpanel").height() * 0.2);
                $("#containerdiv").height($("#cushacenterpanel").height() * 0.65);
                $("#container1").height($("#cushacenterpanel").height() * 0.65);
                $("#container2").height($("#cushacenterpanel").height() * 0.65);
                $("#cushashengchanshengyuwancheng").height($("#cushawestpanel").height() * 0.2);

                $.mfgjs.shengchancusha(keyValue);
                $.mfgjs.shengchancushashengyu(keyValue);
                // 获取班次生产柱状图
                $.mfgjs.bancishengchancolumn();

                // 获取班次生产饼图
                $.mfgjs.bancishengchanpie();
            }
        }

        function btn_shebei(event) {
            var keyValue = $("#gridTable").jqGridRowValue("EquNo");

            if (checkedRow(keyValue)) {


                $("#cushacenterpanel").html("");
                $("#west-Panel").html("");

                $.mfgjs.initshebeicushajiemian();
                $("#cushawestpanel").height(height - 100);
                $("#cushacenterpanel").height(height - 120);
                $("#gridTable").setGridHeight($("#cushawestpanel").height() * 0.5);
                $("#quxiancontainer").height($("#cushacenterpanel").height() * 0.45);
                $("#containersudu").height($("#cushacenterpanel").height() * 0.45);
                $("#containerwendu").height($("#cushacenterpanel").height() * 0.45);

                $("#bingtucontainer").height($("#cushacenterpanel").height() * 0.4);
                $("#bingtu1").height($("#cushacenterpanel").height() * 0.4);
                //$("#bingtu2").height($("#cushacenterpanel").height() * 0.35);
                //$("#cushashengchandangqianfangsha").height($("#cushawestpanel").height() * 0.2);

                $.mfgjs.shengchancushadangqianfangsha(keyValue);

                //当前班次停车原因占比饼图
                $.mfgjs.tingcheyuanyindangqianpie();

                //当日其他班次停车原因占比饼图
                //$.mfgjs.tingcheyuanyinqitafirst();
                //$.mfgjs.tingcheyuanyinqitasecond();
                $.mfgjs.luoshasuduquxian();
                $.mfgjs.lushawenduquxian();

            }
        }

        function btn_state(event) {
            var keyValue = $("#gridTable").jqGridRowValue("EquNo");
            if (checkedRow(keyValue)) {
                $("#cushacenterpanel").html("");
                $("#west-Panel").html("");
                $.mfgjs.initcushazhuangtaijiemian();
                $("#cushacenterpanel").height(height - 120);
                $("#gridTable").setGridHeight($("#cushawestpanel").height() - 175);
                $("#zhujizhangtai").height(($("#cushacenterpanel").height() - 45) * 0.5);
                $("#luoshazhuangtai").height(($("#cushacenterpanel").height() - 45) * 0.5);
                $("#zhujiguzhang").height(($("#cushacenterpanel").height() - 45) * 0.5);
                $("#lushaguzhang").height(($("#cushacenterpanel").height() - 45) * 0.5);

                $.mfgjs.zhujizhangtailiebiao(keyValue);
                $.mfgjs.luoshazhaungtailiebiao(keyValue);
                $.mfgjs.zhujiguzhangliebiao(keyValue);
                $.mfgjs.luoshaguzhangliebiao(keyValue);

            }
        }

        function alarm(event) {
            var keyValue = $("#gridTable").jqGridRowValue("EquNo");
            dialogOpen({
                id: "Form",
                title: '报警信息故障排查-' + keyValue,
                url: '../MFG/AlarmPaicha.html',
                width: "600px",
                height: "600px",
                btn: null
            });
        }


    </script>

</body>

</html>